<template>
	<view class="ov">
		<view class="pr kjhjdeert" :style="{height:hhgbsd+'px'}">
			<scroll-view scroll-y="true" class="h100 " :scroll-into-view="jhbnsd">
				<view class="pd" v-for="(sd,idx) in datas" :key="idx" :id="sd.letter">
					<view class="cf fz32">
						{{sd.letter}}
					</view>
					<view class="row sderttr pt20 pm20" v-for="(sf,idx) in sd.data" @tap="urllx(sf.id,sf.brand_name)" :key="idx">
					
						<view class="ml30">
							<image :src="sf.brand_logo" class="yj useertty cz"></image>
						</view>
						<view class="cf fz32 pl20">
							{{sf.brand_name}}
						</view>
					</view>
				</view>
			</scroll-view>
			<view class="kjnxeerty">
				<view class="drttsewert" v-for="(sd,idx) in datas" :key="idx" @tap="kkjnxert(sd.letter)">
					<text class="cf" v-if="jhbnsd==sd.letter">{{sd.letter}}</text>
					<text class="z9" v-else>{{sd.letter}}</text>
				</view>
			</view>

		</view>
	</view>
</template>
<script>
	import airport from '@/common/airport.js'
	export default {
		data() {
			return {
				list: airport.list,
				jhbnsd: 'A',
				hhgbsd: 0,
				xzsdfd: [],
				datas:[],
				demodata:{
					"A":0,"B":1,"C":2,"D":3,"E":4,"F":5,"G":6,"H":7,"I":8,"J":9,"K":10,"L":11,
					"M":12,"N":13,"O":14,"P":15,"Q":16,"R":17,"S":18,"T":19,"U":20,"V":21,"W":22,
					"X":23,"Y":24,"Z":25
					} 
			}
		},
		components: {

		},
		onNavigationBarButtonTap() {
			uni.navigateBack({
				delta:1
			})
		},
		onLoad() {
			
			uni.showLoading()
			let hggsde = uni.getSystemInfoSync().windowHeight
			this.hhgbsd = hggsde - 40
			this.getssq(1,null);
		},
		methods: {
			getParamValue(paramType, code) {
			  if (!Object.prototype.hasOwnProperty.call(this.paramsMap, paramType)) {
			    return '参数类型错误';
			  }
			  return this.paramsMap[paramType][code];
			},
			jjhssdf(sf) {
				if (sf.cls) {
					sf.cls = ''
				} else {
					sf.cls = "act"
				}
				this.xzsdfd= []
				this.list.map(a=>{
					a.data.map(b=>{
						if(b.cls){
							this.xzsdfd.push(b)
						}
					})
				})
				if(this.xzsdfd.length>0){
					this.hhgbsd =  uni.getSystemInfoSync().windowHeight - 180
				}else{
					this.hhgbsd =  uni.getSystemInfoSync().windowHeight - 110
				}
				
			},
			kkjnxert(e) {
				this.jhbnsd = e
			},
			async getssq(type,id){
				var that = this
				let urls = '/api/brands/'
				let datas =  await this.get(urls)
				uni.showLoading()
				let brands = datas.data
				for(var j in brands){
					let jsons = {}
				    jsons.letter = j
				    jsons.data = brands[j]
					that.datas.push(jsons)
				}
				uni.hideLoading()
				console.log(that.datas);
					// that.datas = brands
			},
			urllx(pid,name){
				uni.$emit('carbrand', {'type':1,id:pid,name:name});
				uni.navigateTo({
					url:'erji?pid='+pid+'&titile='+name
				})
			}
		},
		mounted() {}
	}
</script>
<style scoped>

</style>
